package com.taotao.manage.controller;

import com.taotao.manage.service.impl.ItemCatService;
import com.taotao.manage.vo.ItemCatResult;
import jdk.nashorn.internal.ir.ReturnNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Qin PengCheng
 * @date 2018/6/25
 */

@Controller
@RequestMapping("api/item/cat")
public class ApiItemCatController {
//    http://manage.taotao.com/rest/api/item/cat?callback=category.getDataService

    @Autowired
    private ItemCatService itemCatService;

    @RequestMapping(method = RequestMethod.GET)
    public ResponseEntity<ItemCatResult> queryAllCategopry(){

        try {
            ItemCatResult itemCatResult = this.itemCatService.queryItemCatResult();
            return ResponseEntity.status(HttpStatus.OK).body(itemCatResult);
        } catch (Exception e) {
            e.printStackTrace();
            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
        }


    }
}
